package com.sam.demo.rabbitmq;

import java.util.Date;
import java.util.UUID;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

import com.sam.demo.rabbitmq.message.SendData;
import com.sam.demo.rabbitmq.sender.Sender;

@SpringBootApplication
public class Application {

	public static void main(String[] args) {
		ApplicationContext app = SpringApplication.run(Application.class, args);
		Sender sender = app.getBean(Sender.class);
		for (int i = 0; i < 3; i++) {
			String msg = UUID.randomUUID().toString();
	    	SendData data = new SendData();
	    	data.setContent(msg);
	    	data.setId(i);
	    	data.setTime(new Date());
			sender.send(data, 0);
			sender.send(data, 1);
			sender.send(data, 2);
		}
	}
}